package com.jinlejia.bbs.bean.base;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author 王进 on 2019/3/11.
 */

public class TagBean implements Parcelable{
    private String value;
    private String valueName;
    private boolean selected;
    public TagBean(){

    }
    protected TagBean(Parcel in) {
        value = in.readString();
        valueName = in.readString();
        selected = in.readByte() != 0;
    }

    public static final Creator<TagBean> CREATOR = new Creator<TagBean>() {
        @Override
        public TagBean createFromParcel(Parcel in) {
            return new TagBean(in);
        }

        @Override
        public TagBean[] newArray(int size) {
            return new TagBean[size];
        }
    };

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getValueName() {
        return valueName;
    }

    public void setValueName(String valueName) {
        this.valueName = valueName;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    @Override
    public String toString() {
        return valueName;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(value);
        dest.writeString(valueName);
        dest.writeByte((byte) (selected ? 1 : 0));
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof TagBean)){
            return false;
        }
        TagBean bean = (TagBean) obj;
        return valueName.trim().equals(String.valueOf(bean.getValueName()).trim());

    }
}
